#!/usr/bin/env python
"""
Update All the Conf-Files of Linux. This script will copy them, which
are all listed in the filenames list, to the current work path.
"""

import string
import os
import shutil

filenames = """
/usr/src/linux/.config
/etc/fstab
/etc/hosts
/etc/network/interfaces
/root/ipforward
/etc/apt/sources.list
/etc/X11/xorg.conf
~/.emacs
~/.bashrc
~/.xinitrc
"""

for file in string.strip(filenames,'\n').split("\n"):
    file = os.path.expanduser(file)
    if os.path.isfile(file):
        print 'File', file.ljust(30),
    else:
        print 'File', file.ljust(30) , 'is not a file or does not exist.'
        continue
    destfile = os.path.join('.', os.path.split(file)[1])
    try:
        shutil.copy2(file,destfile)
        print 'is copied to', destfile
    except IOError:
        print  'can not be copied!!!'


